package com.live.service;

import java.util.List;

import com.live.dao.ApplyDao;
import com.live.model.Apply;
import com.live.model.ApplyStatus;

public class ApplyService {
	private ApplyDao applyDao = new ApplyDao();
	public List<ApplyStatus> getApplyStatus() {
		return applyDao.getApplyStatus();
	}
	public int addApply(Apply apply) {
		return applyDao.addApply(apply);
	}
	public int editApply(Apply apply) {
		return applyDao.editApply(apply);
	}

	public List<Apply> getPageApply(int pageIndex, int pageSize) {
		return applyDao.getPageApply(pageIndex, pageSize);
	}

	public List<Apply> getPageOurselfApply(int adminId, int pageIndex,
			int pageSize) {
		return applyDao.getPageOurselfApply(adminId, pageIndex, pageSize);
	}
	
	public int getTotalPage(int pageSize) {
		int totalCount = applyDao.getTotalCount();
		int totalPage = 0;
		if(totalCount % pageSize == 0 ){
			totalPage = totalCount / pageSize;	
		}else{
			totalPage = totalCount / pageSize + 1;
		}
			return totalPage;
	}
	public int getTotalCount(){
		return applyDao.getTotalCount();
	}
	public int getTotalOurselfPage(int adminId,int pageSize) {
		int totalCount =  applyDao.getTotalOurselfCount(adminId);
		int totalPage = 0;
		if(totalCount % pageSize == 0 ){
			totalPage = totalCount / pageSize;	
		}else{
			totalPage = totalCount / pageSize + 1;
		}
			return totalPage;
	}
	public int getTotalOurselfCount(int adminId){
		return applyDao.getTotalOurselfCount(adminId);
	}
 }
